#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1e5 + 5;

int n, m;
int a[N];
struct Node {
  int val, rank, tag;
  int ch[2], sz;
} tr[N];
#define lc(p) tr[p].ch[0]
#define rc(p) tr[p].ch[1]
int root;
int newnode(int val) {
  static int tot = 0;
  ++tot;
  tr[tot].val = val;
  tr[tot].rank = rand();
  tr[tot].sz = 1;
  return tot;
}
void pushup(int p) { tr[p].sz = tr[lc(p)].sz + tr[rc(p)].sz + 1; }
void pushdown(int p) {
  if (tr[p].tag) {
    swap(lc(p), rc(p));
    tr[lc(p)].tag ^= 1;
    tr[rc(p)].tag ^= 1;
    tr[p].tag = 0;
  }
}
void split(int p, int k, int& l, int& r) {
  if (!p) {
    l = r = 0;
    return;
  }
  pushdown(p);
  if (tr[lc(p)].sz >= k) {
    r = p;
    split(lc(r), k, l, lc(r));
    pushup(r);
  } else {
    l = p;
    k -= tr[lc(p)].sz + 1;
    split(rc(l), k, rc(l), r);
    pushup(l);
  }
}
int merge(int x, int y) {
  if (!x || !y) return x + y;
  if (tr[x].rank >= tr[y].rank) {
    pushdown(x);
    rc(x) = merge(rc(x), y);
    pushup(x);
    return x;
  } else {
    pushdown(y);
    lc(y) = merge(x, lc(y));
    pushup(y);
    return y;
  }
}
void dfs(int p) {
  if (!p) return;
  pushdown(p);
  dfs(lc(p));
  cout << tr[p].val << ' ';
  dfs(rc(p));
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  rep(i, 1, n) {
    int p = newnode(i);
    root = merge(root, p);
  }
  while (m--) {
    int l, r;
    cin >> l >> r;
    if (l > r) swap(l, r);
    int x, y, z;
    split(root, r, y, z);
    split(y, l - 1, x, y);
    tr[y].tag ^= 1;
    root = merge(merge(x, y), z);
  }
  dfs(root);
  return 0;
}